import request from '@/utils/request'
import { API_CONFIG } from '@/config'

// 用户登录
export function login(data) {
    return request({
        url: API_CONFIG.USER_LOGIN,
        method: 'post',
        data
    })
}

// 用户登出
export function logout() {
    return request({
        url: API_CONFIG.USER_LOGOUT,
        method: 'post'
    })
}

// 获取用户信息
export function getUserInfo() {
    return request({
        url: API_CONFIG.USER_INFO,
        method: 'get'
    })
}

// 获取用户列表
export function getUserList(params) {
    return request({
        url: API_CONFIG.USER_LIST,
        method: 'get',
        params
    })
}

// 新增用户
export function addUser(data) {
    return request({
        url: API_CONFIG.USER_ADD,
        method: 'post',
        data
    })
}

// 更新用户
export function updateUser(data) {
    return request({
        url: API_CONFIG.USER_UPDATE,
        method: 'post',
        data
    })
}

// 删除用户
export function deleteUser(id) {
    return request({
        url: `${API_CONFIG.USER_DELETE}/${id}`,
        method: 'delete'
    })
}

// 重置用户密码
export function resetUserPassword(id) {
    return request({
        url: `${API_CONFIG.USER_RESET_PASSWORD}/${id}`,
        method: 'put'
    })
}

// 更新用户密码
export function updateUserPassword(data) {
    return request({
        url: API_CONFIG.USER_UPDATE_PASSWORD,
        method: 'put',
        data
    })
}

// 更新用户审核状态
export function updateUserAuditStatus(id, auditStatus) {
    return request({
        url: API_CONFIG.USER_UPDATE_STATUS,
        method: 'put',
        data: { id, auditStatus }
    })
}

// 审核通过
export function approveUser(data) {
    return request({
        url: API_CONFIG.USER_AUDIT,
        method: 'post',
        data
    })
} 